<?php

namespace Modules\Chinadmin\Models;

/**
 * 上传资源表
 * Class UploadFileModel
 * @package Modules\Chinadmin\Models
 */
class UploadFileModel extends BaseModel
{
    public $table = 'ca_upload_files';
    public $primaryKey = 'file_id';
    protected $appends = [];

    /**
     * @param $value
     * @param $data
     * @return string
     */
    public function getFileUrlAttribute($value)
    {
        if ($this->storage === 'local') {
            return request()->root() . $value;
        }
        return $value;
    }

}
